package com.lvy.hczn.front.business.service.impl;

import java.util.List;

import com.lvy.hczn.front.business.mapper.TransferOrderDetailMapper;
import com.lvy.hczn.front.business.service.TransferOrderDetailService;
import com.lvy.hczn.front.common.utils.DateUtils;
import com.lvy.hczn.front.system.domain.business.TransferOrderDetail;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lvy.hczn.front.common.core.text.Convert;

/**
 * 调拨单明细Service业务层处理
 *
 * @author ruoyi
 * @date 2023-08-16
 */
@Slf4j
@Service
public class TransferOrderDetailServiceImpl extends ServiceImpl<TransferOrderDetailMapper, TransferOrderDetail> implements TransferOrderDetailService {
    @Autowired
    private TransferOrderDetailMapper transferOrderDetailMapper;

    /**
     * 查询调拨单明细
     *
     * @param id 调拨单明细主键
     * @return 调拨单明细
     */
    @Override
    public TransferOrderDetail selectTransferOrderDetailById(String id) {
        return transferOrderDetailMapper.selectById(id);
    }

    /**
     * 查询调拨单明细列表
     *
     * @param transferOrderDetail 调拨单明细
     * @return 调拨单明细
     */
    @Override
    public List<TransferOrderDetail> selectTransferOrderDetailList(TransferOrderDetail transferOrderDetail) {
        return transferOrderDetailMapper.selectTransferOrderDetailList(transferOrderDetail);
    }

    /**
     * 新增调拨单明细
     *
     * @param transferOrderDetail 调拨单明细
     * @return 结果
     */
    @Override
    public int insertTransferOrderDetail(TransferOrderDetail transferOrderDetail) {
        return transferOrderDetailMapper.insert(transferOrderDetail);
    }

    /**
     * 修改调拨单明细
     *
     * @param transferOrderDetail 调拨单明细
     * @return 结果
     */
    @Override
    public int updateTransferOrderDetail(TransferOrderDetail transferOrderDetail) {
        return transferOrderDetailMapper.updateById(transferOrderDetail);
    }

    /**
     * 批量删除调拨单明细
     *
     * @param ids 需要删除的调拨单明细主键
     * @return 结果
     */
    @Override
    public int deleteTransferOrderDetailByIds(String ids) {
        String[] arrayId = Convert.toStrArray(ids);
        for (String id : arrayId) {
            transferOrderDetailMapper.deleteById(id);
        }
        return arrayId.length;
    }

    /**
     * 删除调拨单明细信息
     *
     * @param id 调拨单明细主键
     * @return 结果
     */
    @Override
    public int deleteTransferOrderDetailById(String id) {
        return transferOrderDetailMapper.deleteById(id);
    }
}
